<div class="search">
  <%form_for(:customers, :url => search_customers_url, :html => {:method => :get}) do%>
    <table>
      <tr>
        <th>Asiakkaan nimi</th>
        <th>Merkintä</th>
        <th>&#160;</th>
      </tr>
      <tr>
        <td><%=text_field('search', 'query') %></td>
        <td><%=collection_select('search', 'tag', Tag.find(:all), "name", "name", {:include_blank => true})%></td>
        <td><%=submit_tag("Hae", :name => '')%></td>
      </tr>
    </table>
  <%end%>
</div>
<div class="vista_toolbar">
  <ul>
    <%= toolbar_add('asiakas', 'customers') %>
    <%= toolbar_delete_selected('customers') %>
  </ul>
</div>
<%form_remote_tag(:url=> {:action => 'destroy_selected'}, :confirm => 'Haluatko varmasti poistaa asiakkaat?', :before => "spinnerOn('customers');", :complete => "spinnerOff('customers');", :html => {:id => 'customers_form'}) do %>
  <table>
    <tr>
      <th>
        &nbsp;
      </th>
      <th>
        Asiakas
      </th>
      <th>
        Puhelin
      </th>
      <th>
        Kotisivu
      </th>
    </tr>
    <%if !@customers.nil?%>
      <%for customer in @customers %>
        <tr>
          <td>
            <%=checkbox_delete_selected('customers', customer.id) %>
          </td>
          <td>
            <%=link_to(customer.name, :action => 'show', :id => customer) %>
          </td>
          <td>
            <%=h(customer.phone) %>
          </td>
          <td>
            <%=h(customer.homepage) %>
          </td>
          <td>
          </td>
        </tr>
      <%end %>
    <%end%>
  </table>
<% end %>
